home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / Rassapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-08  |  10.3 KB  |  385 lines

  1. /******************************************************************\
  2. *                     Microsoft Windows NT                         *
  3. *               Copyright(c) Microsoft Corp., 1992-1996            *
  4. \******************************************************************/
  5.  
  6. /*++
  7.  
  8. Module Name:
  9.  
  10.     RASSAPI.H
  11.  
  12. Description:
  13.  
  14.     This file contains the RASADMIN structures, defines and
  15.     function prototypes for the following APIs and they can
  16.     be imported from RASSAPI.DLL:
  17.  
  18.      RasAdminServerGetInfo
  19.      RasAdminGetUserAccountServer
  20.      RasAdminUserSetInfo
  21.      RasAdminUserGetInfo
  22.      RasAdminPortEnum
  23.      RasAdminPortGetInfo
  24.      RasAdminPortClearStatistics
  25.      RasAdminPortDisconnect
  26.      RasAdminFreeBuffer
  27.  
  28. Note:
  29.  
  30.     This header file and the sources containing the APIs will work
  31.     only with UNICODE strings.
  32.  
  33. --*/
  34.  
  35.  
  36. #ifndef _RASSAPI_H_
  37. #define _RASSAPI_H_
  38.  
  39. #ifndef UNLEN
  40. #include <lmcons.h>
  41. #endif
  42.  
  43. #define RASSAPI_MAX_PHONENUMBER_SIZE     128
  44. #define RASSAPI_MAX_MEDIA_NAME             16
  45. #define RASSAPI_MAX_PORT_NAME                16
  46. #define RASSAPI_MAX_DEVICE_NAME          128
  47. #define RASSAPI_MAX_DEVICETYPE_NAME       16
  48. #define RASSAPI_MAX_PARAM_KEY_SIZE        32
  49.  
  50. // Bits indicating user's Remote Access privileges and mask to isolate
  51. // call back privilege.
  52. //
  53. // Note: Bit 0 MUST represent NoCallback due to a quirk of the "userparms"
  54. //       storage method.  When a new LAN Manager user is created, bit 0 of the
  55. //       userparms field is set to 1 and all other bits are 0.  These bits are
  56. //       arranged so this "no Dial-In info" state maps to the "default Dial-In
  57. //       privilege" state.
  58.  
  59. #define RASPRIV_NoCallback        0x01
  60. #define RASPRIV_AdminSetCallback  0x02
  61. #define RASPRIV_CallerSetCallback 0x04
  62. #define RASPRIV_DialinPrivilege   0x08
  63.  
  64. #define RASPRIV_CallbackType (RASPRIV_AdminSetCallback \
  65.                               | RASPRIV_CallerSetCallback \
  66.                               | RASPRIV_NoCallback)
  67.  
  68. //
  69. // Modem condition codes
  70. //
  71. #define    RAS_MODEM_OPERATIONAL         1    // No modem errors.
  72. #define    RAS_MODEM_NOT_RESPONDING     2
  73. #define    RAS_MODEM_HARDWARE_FAILURE   3
  74. #define    RAS_MODEM_INCORRECT_RESPONSE 4
  75. #define    RAS_MODEM_UNKNOWN             5
  76. //
  77. // Line condition codes
  78. //
  79. #define    RAS_PORT_NON_OPERATIONAL 1
  80. #define    RAS_PORT_DISCONNECTED     2
  81. #define    RAS_PORT_CALLING_BACK    3
  82. #define    RAS_PORT_LISTENING        4
  83. #define    RAS_PORT_AUTHENTICATING  5
  84. #define    RAS_PORT_AUTHENTICATED     6
  85. #define    RAS_PORT_INITIALIZING     7
  86.  
  87. // The following three structures are same as the ones
  88. // defined in rasman.h and have been renamed to prevent
  89. // redefinitions when both header files are included.
  90.  
  91. enum RAS_PARAMS_FORMAT {
  92.  
  93.     ParamNumber        = 0,
  94.  
  95.     ParamString        = 1
  96.  
  97. } ;
  98. typedef enum RAS_PARAMS_FORMAT    RAS_PARAMS_FORMAT ;
  99.  
  100. union RAS_PARAMS_VALUE {
  101.  
  102.     DWORD    Number ;
  103.  
  104.     struct    {
  105.         DWORD    Length ;
  106.         PCHAR    Data ;
  107.         } String ;
  108. } ;
  109. typedef union RAS_PARAMS_VALUE    RAS_PARAMS_VALUE ;
  110.  
  111. struct RAS_PARAMETERS {
  112.  
  113.     CHAR    P_Key    [RASSAPI_MAX_PARAM_KEY_SIZE] ;
  114.  
  115.     RAS_PARAMS_FORMAT    P_Type ;
  116.  
  117.     BYTE    P_Attributes ;
  118.  
  119.     RAS_PARAMS_VALUE    P_Value ;
  120.  
  121. } ;
  122. typedef struct RAS_PARAMETERS    RAS_PARAMETERS ;
  123.  
  124. // structures used by the RASADMIN APIs
  125.  
  126. typedef struct _RAS_USER_0
  127. {
  128.     BYTE bfPrivilege;
  129.     WCHAR szPhoneNumber[ RASSAPI_MAX_PHONENUMBER_SIZE + 1];
  130. } RAS_USER_0, *PRAS_USER_0;
  131.  
  132. typedef struct _RAS_PORT_0
  133. {
  134.     WCHAR wszPortName[RASSAPI_MAX_PORT_NAME];
  135.     WCHAR wszDeviceType[RASSAPI_MAX_DEVICETYPE_NAME];
  136.     WCHAR wszDeviceName[RASSAPI_MAX_DEVICE_NAME];
  137.     WCHAR wszMediaName[RASSAPI_MAX_MEDIA_NAME];
  138.     DWORD reserved;
  139.     DWORD Flags;
  140.     WCHAR wszUserName[UNLEN + 1];
  141.     WCHAR wszComputer[NETBIOS_NAME_LEN];
  142.     DWORD dwStartSessionTime;          // seconds from 1/1/1970
  143.     WCHAR wszLogonDomain[DNLEN + 1];
  144.     BOOL fAdvancedServer;
  145. } RAS_PORT_0, *PRAS_PORT_0;
  146.  
  147.  
  148. // Possible values for MediaId
  149.  
  150. #define MEDIA_UNKNOWN       0
  151. #define MEDIA_SERIAL        1
  152. #define MEDIA_RAS10_SERIAL  2
  153. #define MEDIA_X25           3
  154. #define MEDIA_ISDN          4
  155.  
  156.  
  157. // Possible bits set in Flags field
  158.  
  159. #define USER_AUTHENTICATED    0x0001
  160. #define MESSENGER_PRESENT     0x0002
  161. #define PPP_CLIENT            0x0004
  162. #define GATEWAY_ACTIVE        0x0008
  163. #define REMOTE_LISTEN         0x0010
  164. #define PORT_MULTILINKED      0x0020
  165.  
  166.  
  167. typedef ULONG IPADDR;
  168.  
  169. // The following PPP structures are same as the ones
  170. // defined in rasppp.h and have been renamed to prevent
  171. // redefinitions when both header files are included
  172. // in a module.
  173.  
  174. /* Maximum length of address string, e.g. "255.255.255.255" for IP.
  175. */
  176. #define RAS_IPADDRESSLEN  15
  177. #define RAS_IPXADDRESSLEN 22
  178. #define RAS_ATADDRESSLEN  32
  179.  
  180. typedef struct _RAS_PPP_NBFCP_RESULT
  181. {
  182.     DWORD dwError;
  183.     DWORD dwNetBiosError;
  184.     CHAR  szName[ NETBIOS_NAME_LEN + 1 ];
  185.     WCHAR wszWksta[ NETBIOS_NAME_LEN + 1 ];
  186. } RAS_PPP_NBFCP_RESULT;
  187.  
  188. typedef struct _RAS_PPP_IPCP_RESULT
  189. {
  190.     DWORD dwError;
  191.     WCHAR wszAddress[ RAS_IPADDRESSLEN + 1 ];
  192. } RAS_PPP_IPCP_RESULT;
  193.  
  194. typedef struct _RAS_PPP_IPXCP_RESULT
  195. {
  196.     DWORD dwError;
  197.     WCHAR wszAddress[ RAS_IPXADDRESSLEN + 1 ];
  198. } RAS_PPP_IPXCP_RESULT;
  199.  
  200. typedef struct _RAS_PPP_ATCP_RESULT
  201. {
  202.     DWORD dwError;
  203.     WCHAR wszAddress[ RAS_ATADDRESSLEN + 1 ];
  204. } RAS_PPP_ATCP_RESULT;
  205.  
  206. typedef struct _RAS_PPP_PROJECTION_RESULT
  207. {
  208.     RAS_PPP_NBFCP_RESULT nbf;
  209.     RAS_PPP_IPCP_RESULT  ip;
  210.     RAS_PPP_IPXCP_RESULT ipx;
  211.     RAS_PPP_ATCP_RESULT  at;
  212. } RAS_PPP_PROJECTION_RESULT;
  213.  
  214. typedef struct _RAS_PORT_1
  215. {
  216.     RAS_PORT_0                 rasport0;
  217.     DWORD                      LineCondition;
  218.     DWORD                      HardwareCondition;
  219.     DWORD                      LineSpeed;        // in bits/second
  220.     WORD                       NumStatistics;
  221.     WORD                       NumMediaParms;
  222.     DWORD                      SizeMediaParms;
  223.     RAS_PPP_PROJECTION_RESULT  ProjResult;
  224. } RAS_PORT_1, *PRAS_PORT_1;
  225.  
  226. typedef struct _RAS_PORT_STATISTICS
  227. {
  228.     // The connection statistics are followed by port statistics
  229.     // A connection is across multiple ports.
  230.     DWORD   dwBytesXmited;
  231.     DWORD   dwBytesRcved;
  232.     DWORD   dwFramesXmited;
  233.     DWORD   dwFramesRcved;
  234.     DWORD   dwCrcErr;
  235.     DWORD   dwTimeoutErr;
  236.     DWORD   dwAlignmentErr;
  237.     DWORD   dwHardwareOverrunErr;
  238.     DWORD   dwFramingErr;
  239.     DWORD   dwBufferOverrunErr;
  240.     DWORD   dwBytesXmitedUncompressed;
  241.     DWORD   dwBytesRcvedUncompressed;
  242.     DWORD   dwBytesXmitedCompressed;
  243.     DWORD   dwBytesRcvedCompressed;
  244.  
  245.     // the following are the port statistics
  246.     DWORD   dwPortBytesXmited;
  247.     DWORD   dwPortBytesRcved;
  248.     DWORD   dwPortFramesXmited;
  249.     DWORD   dwPortFramesRcved;
  250.     DWORD   dwPortCrcErr;
  251.     DWORD   dwPortTimeoutErr;
  252.     DWORD   dwPortAlignmentErr;
  253.     DWORD   dwPortHardwareOverrunErr;
  254.     DWORD   dwPortFramingErr;
  255.     DWORD   dwPortBufferOverrunErr;
  256.     DWORD   dwPortBytesXmitedUncompressed;
  257.     DWORD   dwPortBytesRcvedUncompressed;
  258.     DWORD   dwPortBytesXmitedCompressed;
  259.     DWORD   dwPortBytesRcvedCompressed;
  260.  
  261. } RAS_PORT_STATISTICS, *PRAS_PORT_STATISTICS;
  262.  
  263. //
  264. // Server version numbers
  265. //
  266. #define RASDOWNLEVEL       10    // identifies a LM RAS 1.0 server
  267. #define RASADMIN_35        35    // Identifies a NT RAS 3.5 server or client
  268. #define RASADMIN_CURRENT   40    // Identifies a NT RAS 4.0 server or client
  269.  
  270.  
  271. typedef struct _RAS_SERVER_0
  272. {
  273.     WORD TotalPorts;             // Total ports configured on the server
  274.     WORD PortsInUse;             // Ports currently in use by remote clients
  275.     DWORD RasVersion;            // version of RAS server
  276. } RAS_SERVER_0, *PRAS_SERVER_0;
  277.  
  278.  
  279. //
  280. // function prototypes
  281. //
  282.  
  283. DWORD APIENTRY RasAdminServerGetInfo(
  284.     IN const WCHAR *  lpszServer,
  285.     OUT PRAS_SERVER_0 pRasServer0
  286.     );
  287.  
  288. DWORD APIENTRY RasAdminGetUserAccountServer(
  289.     IN const WCHAR * lpszDomain,
  290.     IN const WCHAR * lpszServer,
  291.     OUT LPWSTR       lpszUserAccountServer
  292.     );
  293.  
  294. DWORD APIENTRY RasAdminUserGetInfo(
  295.     IN const WCHAR   * lpszUserAccountServer,
  296.     IN const WCHAR   * lpszUser,
  297.     OUT PRAS_USER_0    pRasUser0
  298.     );
  299.  
  300. DWORD APIENTRY RasAdminUserSetInfo(
  301.     IN const WCHAR       * lpszUserAccountServer,
  302.     IN const WCHAR       * lpszUser,
  303.     IN const PRAS_USER_0   pRasUser0
  304.     );
  305.  
  306. DWORD APIENTRY RasAdminPortEnum(
  307.     IN  const WCHAR * lpszServer,
  308.     OUT PRAS_PORT_0 * ppRasPort0,
  309.     OUT WORD *        pcEntriesRead
  310.     );
  311.  
  312. DWORD APIENTRY RasAdminPortGetInfo(
  313.     IN const WCHAR *            lpszServer,
  314.     IN const WCHAR *            lpszPort,
  315.     OUT RAS_PORT_1 *            pRasPort1,
  316.     OUT RAS_PORT_STATISTICS *   pRasStats,
  317.     OUT RAS_PARAMETERS **       ppRasParams
  318.     );
  319.  
  320. DWORD APIENTRY RasAdminPortClearStatistics(
  321.     IN const WCHAR * lpszServer,
  322.     IN const WCHAR * lpszPort
  323.     );
  324.  
  325. DWORD APIENTRY RasAdminPortDisconnect(
  326.     IN const WCHAR * lpszServer,
  327.     IN const WCHAR * lpszPort
  328.     );
  329.  
  330. DWORD APIENTRY RasAdminFreeBuffer(
  331.     PVOID Pointer
  332.     );
  333.  
  334. DWORD APIENTRY RasAdminGetErrorString(
  335.     IN  UINT    ResourceId,
  336.     OUT WCHAR * lpszString,
  337.     IN  DWORD   InBufSize );
  338.  
  339. BOOL APIENTRY RasAdminAcceptNewConnection (
  340.     IN         RAS_PORT_1 *              pRasPort1,
  341.     IN      RAS_PORT_STATISTICS *   pRasStats,
  342.     IN      RAS_PARAMETERS *        pRasParams
  343.     );
  344.  
  345. VOID APIENTRY RasAdminConnectionHangupNotification (
  346.     IN         RAS_PORT_1 *              pRasPort1,
  347.     IN      RAS_PORT_STATISTICS *   pRasStats,
  348.     IN      RAS_PARAMETERS *        pRasParams
  349.     );
  350.  
  351. DWORD APIENTRY RasAdminGetIpAddressForUser (
  352.     IN         WCHAR  *        lpszUserName,
  353.     IN         WCHAR  *        lpszPortName,
  354.     IN OUT     IPADDR *       pipAddress,
  355.     OUT        BOOL     *    bNotifyRelease
  356.     );
  357.  
  358. VOID APIENTRY RasAdminReleaseIpAddress (
  359.     IN         WCHAR  *        lpszUserName,
  360.     IN         WCHAR  *        lpszPortName,
  361.     IN         IPADDR *       pipAddress
  362.     );
  363.  
  364. // The following two APIs are used to get/set
  365. // RAS user permissions in to a UsrParms buffer
  366. // obtained by a call to NetUserGetInfo.
  367. //
  368. // Note that RasAdminUserGetInfo and RasAdminUserSetInfo
  369. // are the APIs you should be using for getting and
  370. // setting RAS permissions.
  371.  
  372. DWORD APIENTRY RasAdminGetUserParms(
  373.     IN  WCHAR          * lpszParms,
  374.     OUT PRAS_USER_0      pRasUser0
  375.     );
  376.  
  377. DWORD APIENTRY RasAdminSetUserParms(
  378.     IN OUT   WCHAR    * lpszParms,
  379.     IN DWORD          cchNewParms,
  380.     IN PRAS_USER_0    pRasUser0
  381.     );
  382.  
  383. #endif // _RASSAPI_H_
  384.  
  385.